package 设计模式;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class StaticFinalSingleton {
    
    private static final StaticFinalSingleton instance = new StaticFinalSingleton();

    private StaticFinalSingleton(){}

    public static StaticFinalSingleton getInstance(){
        System.out.println(Thread.currentThread().getName() + "...get instance...");
        return StaticFinalSingleton.instance;
    }
    public static void main(String[] args) {
        ExecutorService threadPool = Executors.newFixedThreadPool(10);
        for(int i = 0; i < 10; i++){
            threadPool.submit(() -> {
                System.out.println(Thread.currentThread().getName() + "...running...");
                StaticFinalSingleton.getInstance();
            });
        }
        threadPool.shutdown();
    }
}
